
module.exports = function ($scope, $state, $stateParams,$resource,$modal,items,$modalInstance,FileUploader) {
    console.log(items);
    $scope.a={};
    $scope.info={'photo':''};
    $scope.applyarr=[
    {name:'区县项目',value:'0'},
    {name:'市级项目',value:'1'},
]

    
            $scope.image = function(){
				var para = $state.get('app.imageupload');
				//设置上传文件夹，以自己业务命名
				angular.extend(para, {
					resolve : {  
						'dir' : function(){
							return 't1';
						}
					} 
				})
				console.log(para);
				var modalInstance = $modal.open(para);
				modalInstance.opened.then(function() {// 模态窗口打开之后执行的函数  
					console.log('modal is opened');  
				});  
				modalInstance.result.then(function(result) {  
					console.log(result);  
					// $scope.imagearr = JSON.stringify(result);
					$scope.array = result;
                    $scope.info.photo=$scope.array;	
				}, function(reason) {  
					console.log(reason);// 点击空白区域，总会输出backdrop  
					// click，点击取消，则会暑促cancel 
					$log.info('Modal dismissed at: ' + new Date());  
				}); 
			};
     $scope.del=function(index){
            $scope.array.splice(index,1);
            $scope.info.photo=$scope.array;
        }

$scope.submit = function(){
    $scope.img = $scope.info.photo.join(",");
    var para = {  
        guide_name:$scope.name,   
        guide_type:$scope.guide_type,
        guide_pdf:$scope.img
     }

     console.log(para);
     $resource('/api/as/ggc/reviewGuide/create', {}, {}).save(para, function(res){
            // console.log(res);
            if(res.errcode === 0){                      
                alert('提交成功');  
                 $modalInstance.close();
            }else{
                alert(res.errmsg);
            }
        });
}
			


};
